home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / AI_TUTOR.ZIP / EXPERT.TXT < prev    next >
Text File  |  1991-04-08  |  23KB  |  500 lines

  1. ╔════════════════════════════════════════════════════════════════════════════╗
  2. ║                                                                            ║
  3. ║                          EXPERT SYSTEMS                                    ║
  4. ║                                                                            ║
  5. ║                "Give your PC some human intelligence"                      ║
  6. ║                                                                            ║
  7. ╚════════════════════════════════════════════════════════════════════════════╝
  8.  
  9.        An Expert System is computer software that can solve real
  10.   world problems requiring logic, decision making and knowledge
  11.   processing.  Expert Systems can also categorize, consult, analyze,
  12.   and diagnose.  These software tools are useful in areas that
  13.   formerly required a human expert. Expert Systems use deductive
  14.   reasoning to solve problems that are often unstructured, and
  15.   would be impossible to approach with conventional procedural
  16.   computer techniques.
  17.  
  18.        An Expert System Shell is an Expert System minus its
  19.   knowledgebase and domain.  It is an Expert System ready to be
  20.   taught the rules of knowledge in a particular field.  An
  21.   Expert System Toolkit is something more: a shell plus an organized
  22.   set of software tools to assist in developing it into a full
  23.   expert system.  Usually, this includes an editor for building
  24.   the IF-THEN rules that make up the rulebase, a trace facility
  25.   for testing the way the rules interact, hooks to pre-existing
  26.   databases and spreadsheets, and a sophisticated user interface
  27.   that hopefully hides all these tools from the user during
  28.   the run-time consultation.
  29.  
  30.        Shareware is user supported software. It is usually
  31.   distributed free through Bulletin Boards, but can also
  32.   be purchased for a disk-copying fee. Shareware
  33.   authors hope that you will like and use their software
  34.   enough to remit the requested registration fee.  (Usually
  35.   $25 to $75). In return, you become a registered user,
  36.   entitled to updates and sometimes a printed manual.
  37.   There are currently about a dozen Shareware Expert Sytem
  38.   Shells on the Boards. I've downloaded and un-archived
  39.   them all, and selected six of the best.
  40.  
  41.        I'm going to give you some information and opinion on each of these
  42.   Shareware Shells: ESIE, Turbo Expert Toolkit, ImpShell, XXXPERT,
  43.   Inference, and Rulemaker.
  44.  
  45.      Each shell was tested with the simple rulebase in Figure 1,
  46.  which will advise you as to whether or not your PC will run the
  47.  new OS/2 operating sytem recently released by IBM for its line
  48.  of PS/2 Personal Computers.  The minimum requirements for running
  49.  OS/2 are a 286 or 386 CPU and 1.5 Meg of Memory (2 Meg for OS/2
  50.  with the DOS Compatability Box). The rulebase was first developed
  51.  and tested in Level5, a popular commercial expert system shell, and then
  52.  modified in syntax as required. I'll comment on just how difficult
  53.  it was to adapt the rulebase to each shell, the ease of running the
  54.  consultation thru the provided user interface, and finally if
  55.  each inference engine generated the correct conclusion.
  56.  
  57.  
  58.  
  59. =============================================================================
  60.     TITLE Will Your PC Run OS/2
  61.  
  62.     1. Your PC will run OS/2
  63.     2. Your PC should run OS/2 with more memory
  64.     3. Your PC will never run OS/2
  65.  
  66.     RULE for Will Run OS/2
  67.     IF      Your CPU is a 386
  68.     AND     Your PC has 2 Meg of Memory
  69.     THEN    Your PC will run OS/2
  70.  
  71.     RULE for Should Run with Modification
  72.     IF     Your CPU is a 286
  73.     AND    Your PC has under 1.5  Meg of Memory
  74.     THEN   Your PC should run OS/2 with more memory
  75.  
  76.     RULE for Will Never Run
  77.     IF     Your CPU is a 8086 or 8088
  78.     AND    Your PC has under 1 Meg of Memory
  79.     THEN   Your PC will never run OS/2
  80.  
  81.  
  82.   Figure 1. Original OS/2 rulebase in LEVEL/5 syntax
  83.  ============================================================================
  84.  
  85.  
  86. 1. ESIE (Lightwave Consultants, PO Box 290539, Tampa, FL 33617 $75)
  87.  
  88.      ESIE is the acronym for Expert System Inference Engine, and
  89.      that is exactly what it is.  ESIE loads in a knowledge base,
  90.      and builds inferences out of the IF-THEN rules, to
  91.      act like an Advisor.  It is an Artificial Intelligence expert
  92.      system shell.  An infinite multitude of knowledge bases can
  93.      be used by ESIE.
  94.  
  95.      The normal gamut of expert systems (ES) can be built for and
  96.      used by ESIE.  Tools such as system configurators, medical
  97.      experts, oil and gas exploration, etc, can all be done in
  98.      ESIE.  ESIE is a rule-based backward chaining inference
  99.      engine.
  100.  
  101.      The acronym was also selected because ESIE is easy to use.
  102.      You just type ESIE at the prompt, and a one-screen shareware
  103.      ad appears. You then type the name of the rulebase to load:
  104.      DOCTOR, ANIMAL, or GLASS. ESIE then begins to ask you
  105.      questions from the rulebase. You can only respond YES or
  106.      NO. The consultation will either lead to a conclusion
  107.      or the statement "UNKNOWN". Options are TRACE ON, TRACE OFF,
  108.      GO, or EXIT. When you EXIT, Esie always says "Have a nice
  109.      day".  This is an excellent shell with excellent documentation.
  110.      The full page shareware notice on the first screen is
  111.      a problem for business use, as is the "Have a nice day".
  112.      The main problem is the lack of confidence factors. You
  113.      can only answer 100% YES or 100% NO.
  114.  
  115.  
  116.     For ESIE, my OS2 rule base had to be restated (Figure 2).
  117.  
  118.  
  119.  
  120.  
  121. ============================================================================
  122.    goal is type.computer
  123.    legalanswers are yes no *
  124.  
  125.    if cpu is no
  126.    then type.cpu is old
  127.  
  128.    if cpu is yes
  129.    then type.cpu is new
  130.  
  131.    question cpu is "Does your PC have a 286 or 386 CPU chip?"
  132.  
  133.    if type.cpu is old
  134.    then type.computer is "your PC will never run OS/2!"
  135.  
  136.    if type.cpu is new
  137.    and memory is yes
  138.    then type.computer is "your PC will run OS/2 perfectly!"
  139.  
  140.    if type.cpu is new
  141.    and memory is no
  142.    then type.computer is "your PC should run OS/2 with more memory"
  143.  
  144.    question MEMORY is "Does your PC have 2 meg or more memory?"
  145.  
  146.    answer is "In my expert opinion " type.computer
  147.  
  148.   Figure 2. Rulebase as modified for ESIE
  149. =========================================================================
  150.         Once this was accomplished, ESIE did a perfect
  151.         job of running the consultation, and could respond
  152.         with the three possible answers appropriately.
  153.         When I turned TRACE ON, ESIE said that the rule
  154.         base had 12 rules(!), three legal questions,
  155.         and two legal answers(!). I've been informed
  156.         that this has been corrected in the latest
  157.         release of this excellent product.
  158.  
  159. 2. TURBO EXPERT TOOLKIT (Thinking Software, 46-16 65th Place,
  160.              Woodside, N.Y. 11377 $59.95)
  161.           The Turbo Expert System Toolkit is based on confidence
  162.         factors (10 means yes, 0 means no, 5 means maybe, 9 means
  163.         almost definitely, etc.)  In addition, with this Toolkit
  164.         you are relieved of the difficult assignment of creating
  165.         an IF-THEN rulebase in a separate ASCII text editor.
  166.         The Turbo Expert Toolkit presents the absolutely
  167.         most direct menu driven approach to generating your own
  168.         rule-based backward chaining expert system.  When it is
  169.         complete, your expert system will ask you (or the user of
  170.         your system) a series of questions (QUERIES) to be answered
  171.         on a scale of 0(No) to 10(Yes). At the conclusion of the
  172.         consultation the Expert will draw a graph of the User's
  173.         responses, and finally display the correct solution (GOAL).
  174.         Turbo Expert never says UNKNOWN.
  175.           Large scale expert systems with hundreds of queries
  176.         and goals can be built, since the Knowledgebase is stored on
  177.         its own separate disk.  In addition, you can build many
  178.         expert systems: just use a separate disk to store the
  179.         Knowledgebase for each. Turbo Expert comes with extensive
  180.         documentation, an online tutorial and demo, plus a Quick
  181.         Reference Chart to help you put up your first Expert System
  182.         in under one hour.
  183.         The registered version also includes two complete
  184.         Expert Systems ready to consult (The Psychology Expert &
  185.         The Stock Market Expert).
  186.  
  187.         Turbo Expert leads you step by step through the process
  188.         of creating a rulebase.  First I pressed 'A' on the
  189.         Main Menu, and was prompted to enter TITLE, AUTHOR and
  190.         DESCRIPTION of my rulebase. Then I pressed 1 and entered
  191.         these three queries:
  192.  
  193.    1.  Does your PC have an 8088 CPU and 640K of memory?
  194.    2.  Does your PC have a 286 or 386 CPU and less than 2 Meg of memory?
  195.    3.  Does your PC have a 286 or 386 CPU and 2 Meg or more of memory?
  196.  
  197.         Next, I pressed 5 on the Main Menu and entered these
  198.         three goals, with numeric links to the appropriate queries.
  199.  
  200.     1. Your PC is most similiar to the original IBM/PC and will not
  201.        run OS/2. (link with 99 to query 1)
  202.     2. Your PC will run OS/2 if you install a total of two Megs of
  203.        memory.   (link with 99 to query 2)
  204.     3. Your PC was designed to run OS/2!  (link with 99 to query 3).
  205.  
  206.         Building the Turbo Expert Rulebase took all of 10
  207.         minutes, and the resulting consultation was the
  208.         only one with a completely natural use of english
  209.         language for the entire process.
  210.  
  211.         In addition, Turbo Expert is the only one of the
  212.         Shareware Shells which comes with an independent
  213.         run-time module to insulate the user from
  214.         the development process and protect the completed
  215.         expert system.
  216.  
  217.  
  218. 3. IMPSHELL (Daniel H. Marcellus, Middletown Programming  Works,
  219.          Middletown,  New York.  Public Domain)
  220.  
  221. The IMP Shell is a powerful expert system development environment for the
  222. IBM-PC.  It contains all the utilities needed to develop and test new expert
  223. systems,  and run  them  when  they  are  finalized.  All functions are menu
  224. driven and appear in windows.   IMP expert systems are rule based,  backwards
  225. chaining systems.   They are very fast and not limited by an artificially
  226. small number of rules.
  227. The IMP Shell is in the public domain and is used in many educational
  228. settings.  It was developed  by Daniel H. Marcellus of the Middletown
  229. Programming  Works,  Middletown,  New York.  It is completely described in the
  230. book "Expert Systems Programming in Turbo Prolog" which is written by
  231. Mr. Marcellus, and published by Prentice-Hall, Englewood Cliffs, N.J. (1987).
  232. An expert system is a program which has captured the expertise  of an expert
  233. in  some field and  can deploy that expertise  with seemingly intelligent
  234. behavior.   For instance  there are expert  systems to do all these things:
  235.  
  236.       Diagnose medical problems
  237.       Guide the repair of complex equipment
  238.       Give advice about taxes and investments
  239.       Guide chemists in synthesizing desired chemicals
  240.       Interpret telemetry data from satellites
  241.       Control nuclear reactors and electric utility grids
  242.  
  243.   A shell makes it easy to set up an expert system by  concentrating on the
  244. problem at  hand  rather  than  on  the details  of  a particular machine
  245. reasoning system or artificial  intelligence language.   This shell was
  246. written entirely  in TURBO  PROLOG,  and the source code is provided,
  247. although you don't need to understand anything about TURBO PROLOG in order to
  248. set up an expert system with this software.
  249. The IMP Shell is menu driven,  and the menu allows you  to select all the
  250. activities  that  are   necessary  at  various  stages   of  the development
  251. of an expert system, for example:
  252.  
  253.         1.   HELP information
  254.         2.   MAKE rules for a new expert system
  255.         3.   INSPECT the rule set that is loaded
  256.         4.   SAVE the rule set that is loaded
  257.         5.   LOAD an existing rule set
  258.         6.   RUN the presently loaded rule set
  259.         7.   EDIT an existing rule set
  260.         8.   PRINT an existing rule set
  261.         9.   DOS access
  262.         10.  END this program
  263.  
  264. The IMP Shell uses backward reasoning.   This means that  it has  the proper
  265. architecture   for   creating   good   expert   systems  for classification
  266. tasks,  for troubleshooting,  and, in  general,   for anything that involves
  267. choosing among  alternatives. It is  not the  proper  architecture  for
  268. applications that require  a well defined sequence  of steps  with
  269. complex reasoning going  into  the application of each step.   Applications
  270. such as configuring  complex equipment or  estimating costs of a project are
  271. of this  sort.   They should be implemented with a forward chaining shell.
  272. I found Impshell more complex than the other Shells presented
  273. here.  The rulebase was difficult to create, and the consultation
  274. insisted on displaying all the possible conclusions. The
  275. correct conclusion had a probability of 1, while the other
  276. two were presented in exactly the same way but with a
  277. probability of 0. Most users would find this confusing.
  278. ============================================================================
  279.    imp("s","n","Your PC was designed to run OS/2","pos",
  280.    "the CPU is a 286/386 and the Memory is 2 meg","dummy","dummy",1)
  281.    imp("s","n","Your PC can run OS/2 after a memory upgrade",
  282.    "pos","the CPU is a 286/386 and memory is under 1.5 meg","dummy","dummy",1)
  283.    imp("s","n","Your PC will never run OS/2","pos",
  284.    "the CPU is 8088 and memory is 640k","dummy","dummy",1)
  285.  
  286.    terminal_node("the CPU is a 286/386 and the Memory is 2 meg")
  287.    terminal_node("the CPU is a 286/386 and memory is under 1.5 meg")
  288.    terminal_node("the CPU is 8088 and memory is 640k")
  289.  
  290.    hypothesis_node("Your PC will never run OS/2")
  291.    hypothesis_node("Your PC will run OS/2 after a memory upgrade")
  292.    hypothesis_node("Your PC was designed to run OS/2")
  293.  
  294. Figure 3. Prolog rule set required for IMPSHELL was more complex then others.
  295. =============================================================================
  296.  
  297. 4. XXXPERT (Stephen Thurber, 1926 Labrador Lane, Vienna, VA 22180 $50)
  298.  
  299.      XXXPERT  is  an  expert  system  development  facility  which
  300.      includes   an   editor,   file  manager  and  expert  systems
  301.      inference   engine   packaged   together  in  one  integrated
  302.      environment.
  303.      You  can use XXXPERT to develop expert systems that use rules
  304.      you  write  in  an  English language syntax.  You can develop
  305.      expert  systems  that will aid you and others in doing things
  306.      that  you  would  not  be  able  to  do  consistently as well
  307.      without   XXXPERT.   XXXPERT  allows  you  to  define  expert
  308.      knowledge  just  once  then  apply  it  repeatedly time after
  309.      time.
  310.      XXXPERT   is   a   rule-driven   system.   Rules  are  simply
  311.      statements  of  logic  that  you  wish to have applied to the
  312.      area   of   expertise  your  rules  are  to  address.   These
  313.      statements   are   written in  English and abbreviations.
  314.      The  first  rule statement in a rules file must be
  315.      on  a  line  by  itself  (and on the first line of the file).
  316.      This  statement  must  specify  the  name of the goal for the
  317.      consultations  to  be  performed with the set of accompanying
  318.      rules.
  319.      XXXPERT  will  need  certain information from the user in the
  320.      course  of  any  given  consultation session depending on the
  321.      rules  being  used  in  that  session.  The "asks" define how
  322.      XXXPERT   should   ask   the   user   (consultee)   for  such
  323.      information.   In  general  you  should  code an ask for each
  324.      identifier  that  appears  in  the  left-hand-side  of a rule
  325.      (before  the  THEN) unless it also appears in the right-hand-
  326.      side of another rule. XXXPERT may take a little longer to
  327.      develop an Expert System, as you must develop the rulebase
  328.      first and then the Questions to ask the user, but it is
  329.      a very complete and professional product. The big problem
  330.      is the difficulty of making your consultation use
  331.      ordinary English Language.
  332.      Figure 4 and 5 shows how I had to abbreviate the
  333.      rulebase and related ASKS for XXXPERT.  The consultation
  334.      had an unnatural/inhuman quality, especially the statement
  335.      of the conclusion.
  336.  
  337. =====================================================================
  338.    RUN.OS2
  339.    IF CPU EQ NO THEN RUN.OS2 EQ NEVER
  340.    IF CPU EQ YES THEN CHECKMEM
  341.    IF CHECKMEM EQ YES THEN RUN.OS2 EQ YES
  342.    IF CHECKMEM EQ NO THEN RUN.OS2 EQ WITH.MORE.MEMORY
  343.  
  344.    Figure 4. The uncomfortably abbreviated rulebase required.
  345. =====================================================================
  346.    CPU
  347.    Does your PC have a 286 or 386 CPU chip?
  348.    CHECKMEM
  349.    Does your PC have 2 meg or more memory?
  350.  
  351.    Figure 5. The related ASKS could use normal English Language.
  352. ====================================================================
  353. 5. INFERENCE (George Hageman, PO BOX 11234, Boulder Colorado 80302 PD)
  354.  
  355.     This inference engine is backwards-chaining only and features the
  356.     running of binary files if:
  357.  
  358.     1) they are antecedents associated with a particuar consequent
  359.        being proved, or
  360.     2) they are consequents which have been proven true by verify().
  361.        their actual predicate value will be determined by their returned
  362.        result after running.
  363.  
  364.     This inference engine is designed with diagnostics in mind and so
  365.     will probably be best suited for this application.  Later revisons
  366.     will include forward-chaining so that the user will have the
  367.     opportunity to give pre-existant conditons, or that these may be
  368.     supplied by the calling process.
  369.  
  370.     See structure design for details of operation,  but basically the
  371.     inference reads in all of the compiled information as produced by the
  372.     rule compiler.
  373.  
  374.     It proceeds to attempt to prove each consequent by proving the truth
  375.     or falseness of any antecedent associated with this consequent.
  376.     if any antecedent of a consequent turns out to be a consequent itself, then
  377.     the inference engine will recursively attempt to prove this
  378.     consequent. The process is complete when all of the predicate values
  379.     of the consequents has been determined.
  380.  
  381.     This Shell is seriously lacking in documentation, however complete C
  382.     Source code is supplied.
  383.     The consultation could probably be more natural
  384.     (although all upper-case) with a little refinement of the rulebase.
  385.  
  386.  
  387. =============================================================================
  388.     ! THIS IS THE KNOWLEDGE BASE FOR THE
  389.     ! OS/2 EXPERT SYSTEM FOR INFERENCE
  390.     !
  391.     IF PC HAS 8088-CPU
  392.     ANDIF PC HAS MEMORY OF 640K
  393.     THEN PC IS OLDPC
  394.     !
  395.     IFNOT PC IS OLDPC
  396.     ANDIF PC HAS MEMORY LESS THAN 1.5 MEG
  397.     THENHYP PC IS WILL-RUN-OS/2-WITH-MEMORY-EXPANSION
  398.     !
  399.     IFNOT PC IS OLDPC
  400.     ANDIF PC HAS MEMORY 2 MEG OR MORE
  401.     THENHYP PC IS WILL-RUN-OS/2-PERFECTLY
  402.     !
  403.     IF PC IS OLDPC
  404.     THENHYP PC IS WILL-NEVER-RUN-OS/2
  405.     !
  406.     IFNOT PC IS WILL-NEVER-RUN-OS/2
  407.     IFNOT PC IS WILL-RUN-OS/2-WITH-MEMORY-EXPANSION
  408.     IFNOT PC IS WILL-RUN-OS/2-PERFECTLY
  409.     THENHYP THIS PC IS NOT WITHIN MY KNOWLEDGE
  410.  
  411.  Figure 6. Rulebase for Inference must be compiled before running
  412. =============================================================================
  413.  
  414. 6. RULEMAKER (Samuel H. Smith, no address given, Public Domain)
  415.  
  416.      This unique program allows you to painlessly prepare a set of
  417.      rules for a decision-tree based expert system. It can be fun!
  418.      You teach the expert by repeatedly "Learning" new facts.
  419.      When you have your rules working properly, you can generate
  420.      a stand-alone expert system in Turbo Pascal.
  421.  
  422.      MENU SELECTIONS:
  423.       New      Create a new knowledge base
  424.       Read     Read a knowledge base from disk
  425.       Write    Write the current knowledgebase to a file
  426.       Display  Display the rules in the current knowledgebase
  427.       Program  Generate a Turbo Pascal Source Program
  428.       Learn    Run this knowledgebase and learn new rules
  429.       Quit     Exit to DOS
  430.  
  431.       Two complete knowledgebase files are included:
  432.       MECHANIC....diagnose your car
  433.       LANGEXP.....Choose the appropriate computer language
  434.               for your next programming project.
  435.  
  436.       This clever little system was a pleasure to work with.
  437.       The rulebase is generated interactively in "Learn"
  438.       Mode. A very nice feature is that you can always
  439.       go back to your original rulebase and teach it
  440.       more rules.  When you are happy with it, you can
  441.       generate a Turbo Pascal Source Program, ready to
  442.       be compiled into a stand alone Expert System.
  443. ==============================================================================
  444. OS/2 EXPERT SYSTEM
  445.  Q:Does your PC have an 8088 CPU and 640K of memory?
  446.    YC:Your PC will never run OS/2
  447.    NQ:Does your PC have a 286 or 386 CPU and less than 1.5 Meg Memory?
  448.       YC:Your PC will run OS/2 with a Memory Upgrade
  449.       NQ:Does your PC have a 286 or 386 CPU and over 2 Meg of Memory?
  450.      YC:Your PC will run OS/2 perfectly!
  451.      NC:No conclusion
  452.  
  453.  Figure 7. This compact rulebase was generated by RULEMAKER
  454. =============================================================================
  455.  
  456. {Expert program OS2.PAS generated by Rulmaker}
  457.  
  458. {$I PXG.INC}
  459.  
  460. begin
  461.    repeat
  462.       writeln;
  463.       writeln('OS/2 EXPERT SYSTEM');
  464.       writeln;
  465.  
  466.       if ask('Does your PC have an 8088 CPU and 640K of memory?') = true then
  467.      conclude('Your PC will never run OS/2')
  468.  
  469.      else    {Does your PC have an 8088 CPU and 640K of memory? = false}
  470.       if ask('Does your PC have a 286 or 386 CPU and less than 1.5 Meg Memory?') = true then
  471.     conclude('Your PC will run OS/2 with a Memory Upgrade')
  472.  
  473.      else    {Does your PC have a 286 or 386 CPU and less than 1.5 Meg Memory? = false}
  474.      if ask('Does your PC have a 286 or 386 CPU and over 2 Meg of Memory?') = true then
  475.           conclude('Your PC will run OS/2 perfectly!')
  476.  
  477.     else    {Does your PC have a 286 or 386 CPU and over 2 Meg of Memory? = false}
  478.         conclude('No conclusion')
  479.  
  480.    until ask('Run again?') = false;
  481.  end.
  482.  
  483.  Figure 8. Rulmaker also generated this Turbo Pascal Program ready to compile.
  484. ==============================================================================
  485.     All these Expert System Shells, with demo rulebases and
  486.    extensive Manuals-on-disk are available on many Bulletin Boards
  487.    for the cost of a download or from the original authors.
  488.    The original authors deserve our support, and if you like
  489.    and use their system you should remit the registration fee.
  490.    If you can't find the programs or don't have a modem or the time
  491.    to download, from Thinking Software, Inc. 46-16 Sixty-fifth Place,
  492.    Woodside, New York 11377. All six are available for $59.95 with an
  493.    informative catalog with many other AI programs and a
  494.    free demo disk. Ask for the "Expert System Pack".
  495.    *Note: as the AITUTOR was "going to press", we received permission
  496.    to include IBIS, a new and extremely powerful Expert System Shell
  497.    in our Expert System Pack. IBIS is from Intelligence Manuafacturing
  498.    Company, and is an Educational, yet fully functional version, of their
  499.    $450 Professional Version.
  500.